package it.traveldream.entities;

import it.traveldream.dto.TransportMeanDTO;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.OneToMany;

/**
 * Entity implementation class for Entity: BookedMean
 *
 */
@Entity
@DiscriminatorValue(ProductType.TRANSPORTMEAN)
public class BookedMean extends BookedProduct  {

	@OneToMany(mappedBy = "hotel", cascade = CascadeType.ALL)
	private List<Reservation> reservations;
	
	private static final long serialVersionUID = 1L;
	
	private Integer quantity;

	public BookedMean() {
		super();
	}
	
	public Integer getQuantity() {
		return this.quantity;
	}

	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}
	
	public List<Reservation> getReservations() {
		return this.reservations;
	}

	public void setReservations(List<Reservation> reservations) {
		this.reservations = reservations;
	}
	
	public MeanType getMeanType() {
		TransportMean mean = (TransportMean) this.product;
		return mean.getMeanType();
	}

	public Departure getDeparture() {
		TransportMean mean = (TransportMean) this.product;
		return mean.getDeparture();
	}

	@Override
	public TransportMeanDTO toDTO() {
		return ((TransportMean)this.getProduct()).toDTO();
	}
}
